// 201.数字范围按位与
package Leetcode_Second_Brush;

public class Solution201 {
    public int rangeBitwiseAnd(int left, int right) {
        int result = left;
        if (result == Integer.MAX_VALUE)
            return result;
        for (int i = left + 1; i <= right; i++) {
            result &= i;
            if (result == 0)
                return 0;
            if (i == Integer.MAX_VALUE)
                return result;
        }
        return result;
    }
}
